<template>
	<view class="goshop-order-list-container">
		<view class="goshop-order-list-wrap">
			<view class="goshop-order-list-box" v-for="(item,index) in data" :key="index" v-if="item.merchantInfo">
				<view class="goshop-order-list-head">
					<view class="goshop-order-list-head-left">
						<view class="iconfont iconfont-shop"></view>
						<view class="u-m-l-10">{{item.merchantInfo ? (item.merchantInfo.nickname ? item.merchantInfo.nickname:'') : ''}}</view>
					</view>
					<view class="goshop-order-list-head-right">{{item.status | statusName(that)}}</view>
				</view>
				<view class="goshop-order-list-body" @tap.stop="$Router.push({ path: '/pages/common/order/info', query: { id: item.id} })">
					<view class="goshop-order-list-body-left">
						<image class="goshop-img-62" :src="item.goodInfo.thumbnail" v-if="item.goodInfo && item.goodInfo.thumbnail"></image>
					</view>
					<view class="goshop-order-list-body-center">
						{{item.goodInfo ? (item.goodInfo.name ? item.goodInfo.name :'') : ''}}
					</view>
					<view class="goshop-order-list-body-right">
						{{moneyText}}{{item.goodInfo ? (item.goodInfo.price ? item.goodInfo.price :'') : ''}}
					</view>
				</view>
				<goshop-order-operate :order="item" :mode="mode"></goshop-order-operate>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"goshop-order-list",
		props: {
		  data:{
				type:Array,
				default:()=>[]
		  },
		  mode:{
			   type:Number,
			   default: 0
		  },
		  status:{
			  type:Number,
			  default: 1
		  }
		},
		filters: {
			statusName(val,that) {
				return that.orderStatusDict[val];
			}
		},
		data() {
			return {
				moneyText:'',
				that:this,
				authStatus:null,
				orderStatusDict:{
					10:this.$t('order.pendingpayment.text'),
					11:this.$t('order.tobeshipped.text'),
					12:this.$t('order.pendingreceipt.text'),
					13:this.$t('order.comment.text'),
					14:this.$t('order.aftersale.text'),
					0:this.$t('order.pendingreview.text'),
					5:this.$t('order.closed.text'),
					100:this.$t('order.completed.text'),
				},
			};
		},
		created() {
			this.authStatus = this.$store.state.member.memberInfo.authStatus;
			this.moneyText = this.$t('common.money.text');
		}
	}
</script>

<style lang="scss">
.goshop-order-list-container{
	padding: 20rpx;
	.goshop-order-list-wrap{
		.goshop-order-list-box{
			background-color: $goshop-color-auxiliary-one;
			border-radius: 20rpx;
			margin-bottom: 20rpx;
			.goshop-order-list-head{
					   display: flex;
					   justify-content: space-between;
					   align-items: center;
					   border-bottom: 2rpx solid $goshop-text-color-four;
					   padding: 20rpx;
					   .goshop-order-list-head-left{
						   display: flex;
						   align-items: center;
					   }
					   .goshop-order-list-head-right{
						   
					   }
			}
			.goshop-order-list-body{
					   display: flex;
					   justify-content: space-between;
					   padding: 20rpx;
					   border-bottom: 2rpx solid $goshop-text-color-four;
					   .goshop-order-list-body-left{
						   
					   }
					   .goshop-order-list-body-center{
						   flex: 3;
						   padding:0 20rpx;
					   }	
					   .goshop-order-list-body-right{
							display: flex;
							justify-content: flex-end;
							align-items: center;
							flex-direction: column;
					   }	
			}
		}
	}
}
</style>